package com.acme.bankapp.domain.bank;

/**
 * Created by anton on 8/18/14.
 */
public abstract class AbstractAccount implements Account {
    protected double balance;

    public AbstractAccount(double balance) {
        if ( balance < 0 ) {
            throw new IllegalArgumentException("Balance must be positive.");
        }
        this.balance = balance;
    }

    @Override
    public double getBalance() {
        return this.balance;
    }

    @Override
    public void deposit(double x) {
        this.balance += x;
    }

    @Override
    abstract public void withdraw(double x) throws NotEnoughFundsException;

    @Override
    abstract public double maximumAmountToWithdraw();
}
